﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YmtAuth.Domain.Model.BlacklistUser;
using YmtAuth.Domain.Repository;
using YmtAuth.Repository.Mongodb;

namespace YmtAuth.Repository.YmtAuthDomainRepository
{
    public class YmatouBlacklistUserRepository : Repository_v1<YmatouBlacklistUser, string>, IYmatouBlacklistUserRepository
    {
        public YmatouBlacklistUserRepository() : base(new DbContext("BlackListUsersMongoUrl")) { }
    }
    public class BulackListRepository : Repository_v1<BlackList, string>, IBlackListRepository
    {
        public BulackListRepository() : base(new DbContext("BlackListUsersMongoUrl")) { }
        //获取IP黑名单配置规则
        public IDictionary<string, string> FindIpblacklistConfiguration(string id)
        {
            return this.Context.GetCollection("Ymt_BlacklistUser_201410", "IpBlackListConfiguration").FindOneByIdAs<IDictionary<string, string>>(id);
        }
        public void SaveIpblacklistConfiguration(IDictionary<string, string> cfg, string id)
        {
            cfg.Add("_id", id);
            this.Context.GetCollection("Ymt_BlacklistUser_201410", "IpBlackListConfiguration").Save<IDictionary<string, string>>(cfg);
        }
    }
}
